var _ = require('lodash');
var assert = require('assert');
var should = require('should');
var config = require('../config');
var fightPowerService = require('../../app/services/fightPowerService.js');
var PlayerManager = require('../../app/libs/playerManager');

suite('fightPowerService', function () {
    suite('refreshFightPower', function () {
        var player_manager = new PlayerManager(config.role_id);

        test('刷新总战力', function (done) {
            player_manager.getModel(['role', 'skill', 'soldier', 'build', 'tech'], function (err) {
                if (!!err) {
                    console.error(err, '计算英雄战力出错（装入相关模块数据出错）');
                    done();
                    return;
                }
                fightPowerService.updateMainPower(player_manager);
                done();
            });
        });

        test('初始化战力', function (done) {
            player_manager.getAllModel(function (err) {
                if (!!err) {
                    console.error(err, '初始化战力（装入相关模块数据出错）');
                    done();
                    return;
                }
                fightPowerService.initFightPower(player_manager);
                player_manager.save(done);
            });
        });
    });
});
